package org.jeecgframework.tag.core.base;

import java.io.IOException;

import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.commons.lang.NotImplementedException;

/**
 * 提供基础的模板解析功能
 * @author JueYue
 * @date 2014年12月2日 下午11:39:58
 */
public abstract class BaseTag extends TagSupport implements IBaseTag {

    private static final long serialVersionUID = 1L;

    @Override
    public int doStartTag() throws JspTagException {
        return EVAL_PAGE;
    }

    @Override
    public int doEndTag() throws JspTagException {
        try {
            JspWriter out = this.pageContext.getOut();
            out.print(parseTag());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return EVAL_PAGE;
    }

    @Override
    public String parseTag() {
        throw new NotImplementedException();
    }

}
